import { GCellRenderer } from "../../../../com/mui/controls/GCellRenderer";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
import { BaseItem } from "../common/BaseItem";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { GiftBagInfo } from "../../model/GiftBagInfo";
import { ECategory } from "../../../../Message/Public/ECategory";
import { EEquip } from "../../../../Message/Public/EEquip";
import { Language } from "../../../../extend/language/Language";
import { EProp } from "../../../../Message/Public/EProp";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
//class RechargeShowRenderer
    
    export  class RechargeShowRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ configUI(): void
        {
            super.configUI();
            this._normalBorder = ObjCreate.createBg(0, 0, 100, 44, this, ImagesConst.RenderNormal);
            this._selectBorder = ObjCreate.createBg(0, 0, 100, 44, this, ImagesConst.RenderSelected);
            this._itemBg = ObjCreate.createBg(4, 4, 36, 36, this, ImagesConst.PackItemBg);
            this._baseItem = new BaseItem();
            this._baseItem.setSize(32, 32);
            this._baseItem.move(6, 6);
            addChild(this._baseItem);
            this._nameTxt = ObjCreate.createGTextField("", 40, 12, 55, 20, this, GlobalStyle.getTextFormatCenter(GlobalStyle.textFormat1));
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc2=0;
            var loc3=0;
            super.data = arg1;
            var loc1=arg1 as GiftBagInfo;
            if (!(loc1 == null) && loc1.code) 
            {
                this._baseItem.itemData = loc1.item;
                loc2 = loc1.item.category;
                loc3 = loc1.item.type;
                if (loc2 == ECategory._ECategoryEquip && loc3 == EEquip._EEquipWing) 
                {
                    this._name = Language.getString(31321);
                }
                else if (loc2 == ECategory._ECategoryEquip && loc3 == EEquip._EEquipFashion) 
                {
                    this._name = Language.getString(31322);
                }
                else if (loc2 != ECategory._ECategoryMount) 
                {
                    if (loc2 == ECategory._ECategoryProp && loc3 == EProp._EPropPetEgg) 
                    {
                        this._name = Language.getString(31324);
                    }
                }
                else 
                {
                    this._name = Language.getString(31323);
                }
                this._nameTxt.htmlText = this._name;
            }
            return;
        }

        public /* override */ set selected(arg1: Boolean)
        {
            super.selected = arg1;
            if (arg1) 
            {
                this._nameTxt.htmlText = "<font color=\'#ffff00\'>" + this._name + "</font>";
                this._selectBorder.visible = true;
                this._normalBorder.visible = false;
            }
            else 
            {
                this._nameTxt.htmlText = "<font color=\'#b1efff\'>" + this._name + "</font>";
                this._selectBorder.visible = false;
                this._normalBorder.visible = true;
            }
            return;
        }

        protected /* var */_normalBorder: ScaleBitmap;

        protected /* var */_selectBorder: ScaleBitmap;

        protected /* var */_itemBg: ScaleBitmap;

        protected /* var */_baseItem: BaseItem;

        protected /* var */_nameTxt: GTextFiled;

        protected /* var */_name: string;
    }
